package com.fenqing.leetcode.code.t2000_2100;

import com.fenqing.annotations.Execute;
import com.fenqing.core.Topic;

import java.util.Arrays;

public class Topic2037 extends Topic {

    @Execute
    public int minMovesToSeat(int[] seats, int[] students) {
        Arrays.sort(seats);
        Arrays.sort(students);
        int sum = 0;
        for (int i = 0; i < seats.length; i++) {
            sum += Math.abs(seats[i] - students[i]);
        }
        return sum;
    }

    public static void main(String[] args) {
        Topic2037 topic2037 = new Topic2037();
        int result = topic2037.run("[3,1,5]", "[2,7,4]");
        System.out.println(result);
    }

}
